﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Brjostagjof_H4.Models.EntryModel>" validateRequest="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">Brjóstagjöf.is | Ný grein</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h3>Ný grein</h3>
    <table id="main-table">
        <tr>

            <td id="main-table-left">
                <script type="text/javascript">
                    $(document).ready(function () {
                        loadCategories();
                    });
                    </script>
                    <script src="../../Scripts/tiny_mce/tiny_mce.js" type="text/javascript"></script>
                    <%--<script type="text/javascript">        tinyMCE.init({
                            // General options
                            mode: "textareas",
                            theme: "advanced",
                            plugins: "autolink,lists,spellchecker,pagebreak,style,layer,table,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

                            // Theme options
                            theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull, fontselect,fontsizeselect",
                            theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,|,insertdate,inserttime,preview,|,forecolor,backcolor",
                            theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
                            theme_advanced_buttons4: "spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
                            theme_advanced_toolbar_location: "top",
                            theme_advanced_toolbar_align: "left",
                            theme_advanced_statusbar_location: "bottom",
                            theme_advanced_resizing: true,

                            // Skin options
                            skin: "o2k7",
                            skin_variant: "silver",

                            // Example content CSS (should be your site CSS)
                            content_css: "css/example.css",
                            // Drop lists for link/image/media/template dialogs
                            template_external_list_url: "js/template_list.js",
                            external_link_list_url: "js/link_list.js",
                            external_image_list_url: "js/image_list.js",
                            media_external_list_url: "js/media_list.js",

                            // Replace values for the template plugin
                            template_replace_values: {
                                username: "Some User",
                                staffid: "991234"
                            }
                        });</script>--%>

                    <!-- TODO olig - put this into a partial view form to reuse on editEntry page as well. Save lines of code. -->
                    <% using (Html.BeginForm()) {%>
                        <%: Html.ValidationSummary(true) %>
        
                        <fieldset class="entry-form">
                            <legend></legend>
            
                            <div class="editor-label">
                                <%: Html.LabelFor(model => model.title) %>
                            </div>
                            <div class="editor-field">
                                <%:Html.TextBoxFor(model => model.title) %> 
                                <%: Html.ValidationMessageFor(model => model.title) %>
                            </div>
            
                            <div class="editor-label">
                                <%: Html.LabelFor(model => model.content) %>
                            </div>
                            <div class="editor-field">
                                <%: Html.TextAreaFor(model => model.content)%>
                                <%: Html.ValidationMessageFor(model => model.content) %>
                            </div>         

                            <div class="editor-label">
                                <%: Html.LabelFor(model => model.category) %>
                            </div>
                            <div>
                                <select class="category-dropdown" name="category" id="category">
                                </select>
                            </div>
                            <div class="editor-label">
                                <%: Html.LabelFor(model => model.entry_type) %>
                            </div>                       
                            <div class="editor-field">
                                <%: Html.DropDownListFor(model => model.entry_type, new SelectList(Brjostagjof_H4.Models.entryType.entryTypes, "typeID", "name")) %>
                                <%: Html.ValidationMessageFor(model => model.entry_type) %>
                            </div>
                            <div class="editor-label"><%: Html.LabelFor(model => model.entry_status) %></div>
                            <div class="editor-field"> <%-- TODO olig - maybe trim this form a bit more. Could use better controls than radio buttons. --%>
                                <input type="radio" name="entry_status" id="published" value="1" /><label for="published"> Birt</label><br />
                                <input type="radio" name="entry_status" id="hidden" value="2" /><label for="hidden"> Falin</label><br />
                                <input type="radio" name="entry_status" id="remove" value="3" /><label for="remove"> Eyða (óafturkræft)</label><br />
                            </div>
                            <div>
                                <input type="submit" value="Vista grein" />
                                <span class="cancel-link"><%: Html.ActionLink("Hætta við", "Entries", "Admin") %></span>
                            </div>
                        </fieldset>

                    <% } %>

                    <!-- Template -->
                    <script id="category-template" type="text/x-jquery-tmpl">
                        <option value='${categoryID}'>${categoryName}</option> 
                    </script>
            </td>

            <td id="main-table-right">
                <div class="options">
                    <% if (User.IsInRole("Administrators")){Html.RenderPartial("~/Views/Home/ProfileAdminMenu.ascx", "Model");} %>
                    <% else if (User.IsInRole("Professionals")) { Html.RenderPartial("~/Views/Home/ProfileProMenu.ascx", "Model"); } %>
                    <% else { Html.RenderPartial("~/Views/Home/ProfileMenu.ascx", "Model"); } %>
                </div>
            </td>

        </tr>
    </table>
   

</asp:Content>